#include "heap_demo.hpp"
#include <cstdlib>
#include <iostream>
#include <vector>
void test() {
  int ia[9] = {0, 1, 8, 9, 2, 3, 4, 3, 5};
  std::vector<int> ivec(ia, ia + 9);
  heap::make_heap(ivec.begin(), ivec.end());
  for (size_t i = 0; i < 9; i++) {
    std::cout << " " << ia[i];
  }
  std::cout << std::endl;
  for (auto i = ivec.begin(); i != ivec.end(); i++) {
    std::cout << " " << *i;
  }
  std::cout << std::endl;
}

void test2() {
  int len = 100;
  int *arr = (int *)std::malloc(sizeof(int) * len);
  for (size_t i = 0; i < len; i++) {
    int r = 100.0f * std::rand() / RAND_MAX;
    arr[i] = r * 1;
    std::cout << " " << arr[i];
  }
  std::cout << std::endl;

  // int arr[] = {1, 4, 2, 5, 3};
  // int len = sizeof(arr) / sizeof(int);
  heap::internal::test_print(arr, len);
  heap::internal::sort_heap(arr, len);
  heap::internal::test_print(arr, len);
}

int main(int argc, char const *argv[]) {
  test2();
  return 0;
}
